<?php

function remove_user($userID) {
	return mysql_delete("users", array("id" => $userID));
}

function get_users() {
	return mysql_array(mysql_select("users"));
}

function get_user($userID) {
	$query = array("id" => $userID);
	return mysql_row_array(mysql_select("users",$query));
}

function get_user_email($userID) {
	$user = get_user($userID);
	return $user['Email'];
}

function has_user_data($userID) {
	if (is_null($userID)) return false;
	foreach (get_user($userID) as $value) {
		if (strlen($value)==0) return false;
	}
	return true;
}

function approve_user($id) {
	$events = mysql_array(mysql_select("events_users",array("user"=>$id)));
	foreach ($events as $event) approve_event($event['id']);
	return mysql_update("users",array("approved"=>1),array("id"=>$id));
}

function get_user_by_event($id) {
	$user = mysql_row_array(mysql_select("events_users",array("event"=>$id)));
	return $user['user'];
}
	

?>